package com.yunyao.web.controller;

import com.yunyao.common.dto.project.ProjectMemberDto;
import com.yunyao.common.web.util.PageResult;
import com.yunyao.common.web.util.YResult;
import com.yunyao.framework.dto.ProjectMember.ProjectMemberSaveDto;
import com.yunyao.framework.service.ProjectMemberService;
import com.yunyao.framework.vo.projectMember.ProjectMemberVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/projectMember")
public class ProjectMemberController {

    @Autowired
    private ProjectMemberService projectMemberService;
    @GetMapping("/list")
    public YResult<PageResult<ProjectMemberVO>> list(ProjectMemberDto projectMemberDto) {
        return projectMemberService.pageList(projectMemberDto);
    }

    @PostMapping("/save")
    public YResult<String> saveInfo(@RequestBody ProjectMemberSaveDto saveDto) {
        return projectMemberService.saveInfo(saveDto);
    }

    @PostMapping("/delete")
    public YResult<Boolean> deleteInfo(@RequestBody ProjectMemberSaveDto saveDto) {
        return projectMemberService.deleteInfo(saveDto.getId());
    }
}
